//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Data;

namespace OpenLS.Spreadsheet.UI
{
    class SortByConverter: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            SortState ss = (SortState)value;
            List<string> result = new List<string>();
            if (ss.SortByColumn)
            {
                foreach (Row c in ss.Range.GetRows())
                    result.Add(c.Label);
            }
            else
            {
                foreach (Column c in ss.Range.GetColumns())
                    result.Add(c.Label);
            }
            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
